/************************************
*  Copyright (C) 2010 Julien MOTTIN.
*  Contact: julien.mottin@gueydan.eu
*
*  This file is part of Gueydan.
*
*  Gueydan is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  Gueydan is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with Gueydan.  If not, see <http://www.gnu.org/licenses/>.
*
*************************************/
#ifndef HOP_H
#define HOP_H

// QtCore
#include <QString>

// Local
#include "weight.h"
#include "duration.h"
#include "beerxmlobject.h"

class QDomNode;

enum HopUse
{
    HUBoil = 0,
    HUDryHop,
    HUMash,
    HUFirstWort,
    HUAroma
};

enum HopType
{
    HTUnset = 0,
    HTBittering,
    HTAroma,
    HTBoth
};

enum HopForm
{
    HFUnset = 0,
    HFPellet,
    HFPlug,
    HFLeaf
};

class Hop : public BeerXMLObject
{
    Q_OBJECT;
	
public:

    // Standard Constructor with all mandatory fields
    Hop(const QString &iName,
        const int iVersion,
        const float iAlpha,
        const Weight &iAmount,
        const HopUse iUse,
        const Duration &iTime);

    // empty Ctor
    Hop();

    // Dtor
    ~Hop();

    // Conveniance Operators
    bool operator==(const Hop &iOther) const;
    bool operator!=(const Hop &iOther) const;
    bool operator==(const BeerXMLObject &iOther) const;
    bool operator!=(const BeerXMLObject &iOther) const;

    /*
    * XML IO
    * returns :
    *   - 0 : Success
    *   - 1 : Invalid XML
    */
    int CreateFromXMLNode(const QDomNode &iNode);
    int ToXMLNode(QDomNode &iParentNode) const;

public:

    // Internal data
    float       _Alpha;
    Weight      _Amount;
    HopUse      _Use;
    Duration    _Time;
    QString     _Notes;
    HopType     _Type;
    HopForm     _Form;
    float       _Beta;
    float       _HSI;
    QString     _Origin;
    QString     _Substitutes;
    float       _Humulene;
    float       _Caryophyllene;
    float       _Cohumulone;
    float       _Myrcene;

private:
    Hop(const Hop &);
    Hop & operator=(const Hop &);
};

#endif // HOP_H
